<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${initProjectVo.packageName}.mapper.UserInfoMapper">
      <select id="selectEntityList" resultType="${initProjectVo.packageName}.dto.UserInfoDTO">
          SELECT
          t1.id, t1.username,t1.user_title,t3.role_name,t1.enable
          FROM
          t_sys_user t1 left join t_sys_user_role t2 on  t1.id = t2.user_id
          left join t_sys_role t3 on t2.role_id = t3.id
        </select>

    <select id="getUserEntityById" resultType="${initProjectVo.packageName}.dto.UserInfoDTO">
        SELECT
        t1.id, t1.username,t3.role_name,t1.enable,t3.id as roleId
        FROM
        t_sys_user t1 left join t_sys_user_role t2 on  t1.id = t2.user_id
        left join t_sys_role t3 on t2.role_id = t3.id
        WHERE t1.id=${"#"}{cm.userId}
    </select>
</mapper>